<script setup lang="ts">
import VueJsonPretty from 'vue-json-pretty';
import 'vue-json-pretty/lib/styles.css';
import {onMounted} from "vue";
import {h, createApp} from "vue"

onMounted(() => {
  const jsonData = `{"code": 0, "msg": "成功"}`
  const data = JSON.parse(jsonData)
  // 生成虚拟dom
  const vNode = h(VueJsonPretty, {data: data}, [])
  // 创建app
  const app = createApp({
    render: () => vNode
  })
  // 挂载到真实dom上去
  app.mount(".json_body")
})

</script>

<template>
  <div>
    <div class="json_body">

    </div>
  </div>
</template>

<style scoped lang="less">

</style>